<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 7.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha256-wiz7ZSCn/btzhjKDQBms9Hx4sSeUYsDrTLg7roPstac=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.css" integrity="sha256-6cQIC71/iBIYXFK+0RHAvwmjwWzkWd+r7v/BX3/vZDc=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/green/pace-theme-minimal.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous"></script>

<script class="next-config" data-name="main" type="application/json">{"hostname":"sumumm.github.io","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.19.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":"mac"},"fold":{"enable":true,"height":300},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":true,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="本文主要是使用官方提供的SDK来驱动LED的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:type" content="article">
<meta property="og:title" content="LV04-03-BSP工程管理-01-NXP官方SDK">
<meta property="og:url" content="https://sumumm.github.io/post/60d938cb.html">
<meta property="og:site_name" content="苏木">
<meta property="og:description" content="本文主要是使用官方提供的SDK来驱动LED的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20230725222943300.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20230725223210684.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108231128760.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20230725223311549.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20230725223424185.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20230725223511101.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108231432633.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108231513047.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108231732108.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108231754147.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108231847004.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108231949813.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108232045368.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108232222020.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108232544959.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108233226929.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108233344721.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108233522145.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108234339000.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108234621773.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108234810461.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108234912254.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108235013631.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108235214530.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108235315643.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108235438401.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109000047807.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109000335236.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109000608729.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109001057719.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109001317852.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109001620071.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109002746246.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109002816679.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109003257181.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109004848638.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109005107980.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109005233167.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109005327756.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109005451529.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109005638457.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109005720748.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109003521525.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109012131735.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109074127335.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109074809711.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20240117190003663.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20230728194306338.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109123712304.png">
<meta property="article:published_time" content="2023-09-08T11:24:05.000Z">
<meta property="article:modified_time" content="2025-06-13T16:25:57.038Z">
<meta property="article:author" content="苏木">
<meta property="article:tag" content="(ALPHA)LV04-裸机开发">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20230725222943300.png">


<link rel="canonical" href="https://sumumm.github.io/post/60d938cb.html">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://sumumm.github.io/post/60d938cb.html","path":"post/60d938cb.html","title":"LV04-03-BSP工程管理-01-NXP官方SDK"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>LV04-03-BSP工程管理-01-NXP官方SDK | 苏木</title>
  








    <script src="/js/browser_tools_disable.js"></script>

  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<!-- hexo injector head_end start --><link rel="stylesheet" href="https://unpkg.com/hexo-next-tags-plus@latest/lib/tag_plus.css" media="defer" onload="this.media='all'"><!-- hexo injector head_end end --></head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">苏木</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">我的学习之路</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>苏木的家</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类页<span class="badge">42</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档页<span class="badge">673</span></a></li><li class="menu-item menu-item-flink"><a href="/flink/" rel="section"><i class="fa fa-link fa-fw"></i>友人帐</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于我</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81I-MX6ULL-%E5%AE%98%E6%96%B9-SDK-%E5%8C%85%E7%AE%80%E4%BB%8B"><span class="nav-text">一、I.MX6ULL 官方 SDK 包简介  </span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-SDK%E7%AE%80%E4%BB%8B"><span class="nav-text">1. SDK简介</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E5%9C%A8%E5%93%AA%E4%B8%8B%E8%BD%BD%EF%BC%9F"><span class="nav-text">2. 在哪下载？</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-Windows%E4%B8%8B%E7%9A%84SDK%E5%AE%89%E8%A3%85"><span class="nav-text">3. Windows下的SDK安装</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-Linux%E4%B8%8B%E7%9A%84SDK%E5%AE%89%E8%A3%85"><span class="nav-text">4. Linux下的SDK安装</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81SDK%E7%9B%AE%E5%BD%95%E3%80%81%E6%96%87%E4%BB%B6%E7%AE%80%E4%BB%8B"><span class="nav-text">二、SDK目录、文件简介</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-boards%EF%BC%9A%E7%A4%BA%E4%BE%8B%E7%A8%8B%E5%BA%8F"><span class="nav-text">1. boards：示例程序</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-CMSIS%EF%BC%9A%E5%8C%85%E5%90%ABCMSIS%E6%A0%87%E5%87%86%E7%9B%B8%E5%85%B3%E7%9A%84%E6%96%87%E4%BB%B6"><span class="nav-text">2. CMSIS：包含CMSIS标准相关的文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-CORTEXA%EF%BC%9ACortex%E7%9B%B8%E5%85%B3%E5%A4%B4%E6%96%87%E4%BB%B6"><span class="nav-text">3. CORTEXA：Cortex相关头文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-devices%EF%BC%9Ai-mx%E5%9B%BA%E4%BB%B6%E5%BA%93"><span class="nav-text">4. devices：i.mx固件库</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#4-1-MCIMX6Y2%E7%9B%AE%E5%BD%95%E4%B8%8B%E7%9A%84%E5%85%A8%E5%B1%80%E6%96%87%E4%BB%B6"><span class="nav-text">4.1 MCIMX6Y2目录下的全局文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-2-gcc%E7%9B%AE%E5%BD%95"><span class="nav-text">4.2 gcc目录</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-3-drivers%E7%9B%AE%E5%BD%95"><span class="nav-text">4.3 drivers目录</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-4-utilities%E7%9B%AE%E5%BD%95"><span class="nav-text">4.4 utilities目录</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-docs%EF%BC%9A%E9%83%A8%E5%88%86%E8%AF%B4%E6%98%8E%E6%96%87%E6%A1%A3"><span class="nav-text">5.  docs：部分说明文档</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-middleware%EF%BC%9A%E4%B8%AD%E9%97%B4%E4%BB%B6"><span class="nav-text">6. middleware：中间件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#7-rtos%EF%BC%9A%E5%AE%9E%E6%97%B6%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F"><span class="nav-text">7. rtos：实时操作系统</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#8-tools%EF%BC%9A%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7"><span class="nav-text">8. tools：开发工具</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#9-%E5%85%B6%E5%AE%83%E6%96%87%E4%BB%B6"><span class="nav-text">9. 其它文件</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%89%E3%80%81%E5%AE%98%E6%96%B9demo"><span class="nav-text">三、官方demo</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-SDK-demo%E8%AF%B4%E6%98%8E"><span class="nav-text">1. SDK demo说明</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-linux%E6%90%AD%E5%BB%BASDK%E7%BC%96%E8%AF%91%E7%8E%AF%E5%A2%83"><span class="nav-text">2. linux搭建SDK编译环境</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-cmake"><span class="nav-text">2.1 cmake</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-%E4%BA%A4%E5%8F%89%E7%BC%96%E8%AF%91%E5%B7%A5%E5%85%B7"><span class="nav-text">2.2 交叉编译工具</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#2-2-1-%E7%94%A8%E7%9A%84%E4%BB%80%E4%B9%88%E4%BA%A4%E5%8F%89%E7%BC%96%E8%AF%91%E5%99%A8%EF%BC%9F"><span class="nav-text">2.2.1 用的什么交叉编译器？</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-2-2-%E5%AE%89%E8%A3%85arm-none-eabi"><span class="nav-text">2.2.2 安装arm-none-eabi</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E7%BC%96%E8%AF%91demo"><span class="nav-text">3. 编译demo</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-%E7%83%A7%E5%BD%95%E5%88%B0SD%E5%8D%A1"><span class="nav-text">4. 烧录到SD卡</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-%E5%BC%80%E5%8F%91%E6%9D%BF%E9%AA%8C%E8%AF%81"><span class="nav-text">5. 开发板验证</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%9B%9B%E3%80%81%E4%BD%BF%E7%94%A8SDK%E6%8E%A7%E5%88%B6GPIO"><span class="nav-text">四、使用SDK控制GPIO</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-SDK%E7%A7%BB%E6%A4%8D"><span class="nav-text">1. SDK移植</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E6%96%B0%E5%BB%BAcc-h%E6%96%87%E4%BB%B6"><span class="nav-text">2. 新建cc.h文件  </span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E5%85%B6%E4%BB%96%E6%96%87%E4%BB%B6"><span class="nav-text">3. 其他文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-%E7%BC%96%E8%AF%91%E5%92%8C%E4%B8%8B%E8%BD%BD"><span class="nav-text">4. 编译和下载</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-%E9%93%BE%E6%8E%A5%E5%9C%B0%E5%9D%80"><span class="nav-text">5. 链接地址</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-%E5%BC%80%E5%8F%91%E6%9D%BF%E6%B5%8B%E8%AF%95"><span class="nav-text">6. 开发板测试</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="苏木"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">苏木</p>
  <div class="site-description" itemprop="description">莫道桑榆晚，为霞尚满天</div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">673</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">42</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">43</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <a href="https://github.com/sumumm" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;sumumm" rel="noopener me" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://sumumm.github.io/post/60d938cb.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="苏木">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="苏木">
      <meta itemprop="description" content="莫道桑榆晚，为霞尚满天">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="LV04-03-BSP工程管理-01-NXP官方SDK | 苏木">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          LV04-03-BSP工程管理-01-NXP官方SDK
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2023-09-08 19:24:05" itemprop="dateCreated datePublished" datetime="2023-09-08T19:24:05+08:00">2023-09-08</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/" itemprop="url" rel="index"><span itemprop="name">嵌入式开发</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/" itemprop="url" rel="index"><span itemprop="name">02IMX6ULL平台</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/" itemprop="url" rel="index"><span itemprop="name">LV04-裸机开发</span></a>
        </span>
    </span>

  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>10k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>37 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><p>本文主要是使用官方提供的SDK来驱动LED的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。</p>
<span id="more"></span>

<!-- Photo: https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/ -->

<details class="folding-tag" blue><summary> 点击查看使用工具及版本 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center" width=150px>Windows版本</td>        <td align="left">windows11</td>    </tr>    <tr>        <td align="center">Ubuntu版本</td>        <td align="left">Ubuntu16.04的64位版本</td>      </tr>    <tr>        <td align="center">VMware® Workstation 16 Pro</td>        <td align="left">16.2.3 build-19376536</td>      </tr>    <tr>        <td align="center">终端软件</td>        <td align="left">MobaXterm(Professional Edition v23.0 Build 5042 (license))</td>      </tr>    <tr>        <td align="center">Linux开发板</td>        <td align="left">正点原子 i.MX6ULL Linux 阿尔法开发板</td>      </tr>    <tr>        <td align="center">uboot</td>        <td align="left">NXP官方提供的uboot，NXP提供的版本为uboot-imx-rel_imx_4.1.15_2.1.0_ga(使用的uboot版本为U-Boot 2016.03)</td>      </tr>    <tr>        <td align="center">linux内核</td>        <td align="left">linux-4.15(NXP官方提供)</td>      </tr>    <tr>        <td align="center">Win32DiskImager</td>        <td align="left">Win32DiskImager v1.0</td>      </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看本文参考资料 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center">分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="center" rowspan="5">官方网站</td>        <td align="left"><a href="https://www.arm.com/" target="_blank">https://www.arm.com/</a></td>        <td align="left">ARM官方网站，在这里我们可以找到Cotex-Mx以及ARMVx的一些文档</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxp.com.cn/" target="_blank">https://www.nxp.com.cn/ </a></td>        <td align="left">NXP官方网站</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxpic.org.cn/" target="_blank">https://www.nxpic.org.cn/</a></td><td align="left">NXP 官方社区</td>    </tr>    <tr>        <td align="left"><a href="https://u-boot.readthedocs.io/en/latest/" target="_blank">https://u-boot.readthedocs.io/en/latest/</a></td><td align="left">u-boot官网</td>    </tr>    <tr>        <td align="left"><a href="https://www.kernel.org/" target="_blank">https://www.kernel.org/</a></td><td align="left">linux内核官网</td>    </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看相关文件下载 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center">分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="center" rowspan="4">NXP</td>        <td align="left"><a href="https://github.com/nxp-imx" target="_blank">https://github.com/nxp-imx</a></td>        <td align="left">NXP imx开发资源GitHub组织，里边会有u-boot和linux内核的仓库</td>    </tr>    <tr>        <td align="left"><a href="https://elixir.bootlin.com/linux/latest/source" target="_blank">https://elixir.bootlin.com/linux/latest/source</a></td>        <td align="left">在线阅读linux kernel源码</td>    </tr>    <tr>        <td align="left"><a href="https://github.com/nxp-imx/linux-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga" target="_blank">nxp-imx/linux-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga</a></td>        <td align="left">NXP linux内核仓库tags中的rel_imx_4.1.15_2.1.0_ga</td>    </tr>    <tr>        <td align="left"><a href="https://github.com/nxp-imx/uboot-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga" target="_blank">nxp-imx/uboot-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga</a></td>        <td align="left">NXP u-boot仓库tags中的rel_imx_4.1.15_2.1.0_ga</td>    </tr>    <tr>        <td align="center" rowspan="2">I.MX6ULL</td>        <td align="left"><a href="https://www.nxp.com.cn/docs/en/data-sheet/IMX6ULLIEC.pdf" target="_blank">i.MX 6ULL Applications Processors for Industrial Products</a></td>        <td align="left">I.MX6ULL 芯片手册（datasheet，可以在线查看）</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxp.com.cn/webapp/Download?colCode=IMX6ULLRM&lang_cd=zh" target="_blank">i.MX 6ULL Applications ProcessorReference Manual</a></td>        <td align="left">I.MX6ULL 参考手册（下载后才能查看，需要登录NXP官网）</td>    </tr></table>
              </div>
            </details>

<h1 id="一、I-MX6ULL-官方-SDK-包简介"><a href="#一、I-MX6ULL-官方-SDK-包简介" class="headerlink" title="一、I.MX6ULL 官方 SDK 包简介  "></a><font size=3>一、I.MX6ULL 官方 SDK 包简介  </font></h1><h2 id="1-SDK简介"><a href="#1-SDK简介" class="headerlink" title="1. SDK简介"></a><font size=3>1. SDK简介</font></h2><p>NXP 针对 I.MX6ULL 编写了一个 SDK 包，这个 SDK 包就类似于 STM32 的 STD 库或者HAL 库，对于这个 SDK 包的安装方式，NXP提供了 Windows 和 Linux 两种版本，分别针对主机系统是 Windows 和Linux（意思就是SDK的安装就跟软件安装一样，后边就会看到啦）。因为我们是在 Windows 下使用 Source Insight 来编写代码的，因此我们使用的是 Windows版本的。 </p>
<p>Windows 版本 SDK 里面的例程提供了 IAR 版本，肯定有人会问既然 NXP 提供了 IAR版本的 SDK，那我们为什么不用 IAR 来完成裸机试验，偏偏要用复杂的 GCC？因为我们要从简单的裸机开始掌握 Linux 下的 GCC 开发方法，包括 Ubuntu 操作系统的使用、 Makefile 的编写、 shell 等等。如果为了偷懒而使用 IAR 开发裸机的话，那么后续学习 Uboot 移植、 Linux 移植和 Linux 驱动开发就会很难上手，因为开发环境都不熟悉！再者，不是所有的半导体厂商都会为 Cortex-A 架构的芯片编写裸机 SDK 包，我使用过那么多的 Cotex-A 系列芯片，也就发现了 NXP 给 I.MX6ULL 编写了裸机 SDK 包。而且去 NXP 官网看一下，会发现只有 I.MX6ULL这一款 Cotex-A 内核的芯片有裸机 SDK 包， NXP 的其它 Cotex-A 芯片都没有。说明在 NXP 的定位里面， I.MX6ULL 就是一个 Cotex-A 内核的高端单片机，定位类似 ST 的 STM32H7。</p>
<p>总的来说就是，使用 Cortex-A 内核芯片的时候不要想着有类似 STM32 库一样的东西， I.MX6ULL 是一个特例，基本所有的 Cortex-A 内核的芯片都不会提供裸机 SDK 包。因此在使用 STM32 的时候那些用起来很顺手的库文件，在 Cotex-A 芯片下基本都需要我们自行编写，比如.s 启动文件、寄存器定义等等。 </p>
<h2 id="2-在哪下载？"><a href="#2-在哪下载？" class="headerlink" title="2. 在哪下载？"></a><font size=3>2. 在哪下载？</font></h2><p>我们来到官网：<a target="_blank" rel="noopener" href="https://www.nxp.com.cn/products/processors-and-microcontrollers/arm-processors/i-mx-applications-processors/i-mx-6-processors/i-mx-6ull-single-core-processor-with-arm-cortex-a7-core:i.MX6ULL">i.MX 6ULL应用处理器_Arm® Cortex®-A7单核，频率为900 MHz | NXP 半导体</a>，找到这个页面：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20230725222943300.png" alt="image-20230725222943300" style="zoom: 33%;" />

<p>我们在windows下安装库的话，就选下边的WIN版进行安装就行。Linux下的话就选第一个。他们只是安装程序不同罢了，安装后得到的SDK库文件是一样的。例如，在windows环境下，我们选择的第二个，下完后会得到这样一个可执行文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20230725223210684.png" alt="image-20230725223210684" style="zoom:50%;" />

<p>如果是选linux，会得到一个.run文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108231128760.png" alt="image-20241108231128760" style="zoom: 60%;" />

<h2 id="3-Windows下的SDK安装"><a href="#3-Windows下的SDK安装" class="headerlink" title="3. Windows下的SDK安装"></a><font size=3>3. Windows下的SDK安装</font></h2><p>我们双击上边的exe可执行文件，就会进入SDK的安装流程，一直 next 下一步就好啦，然后在这里我们要选择一下安装的位置：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20230725223311549.png" alt="image-20230725223311549" style="zoom:50%;" />

<p>然后继续一直下一步就可以啦，安装完成如下所示：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20230725223424185.png" alt="image-20230725223424185" style="zoom:50%;" />

<p>然后我们来看一下安装目录下的文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20230725223511101.png" alt="image-20230725223511101" style="zoom: 33%;" />

<p>我们就不重点学习这个 SDK 包了，所有的例程都在 boards 这个文件夹里面。我们重点是需要 SDK 包里面与寄存器定义相关的文件，一共需要如下三个文件：</p>
<blockquote>
<p>fsl_common.h：位置为 SDK_2.2_MCIM6ULL&#x2F;devices&#x2F;MCIMX6Y2&#x2F;driver&#x2F;fsl_common.h</p>
<p>fsl_iomuxc.h：位置为 SDK_2.2_MCIM6ULL&#x2F;devices&#x2F;MCIMX6Y2&#x2F;drivers&#x2F;fsl_iomuxc.h</p>
<p>MCIMX6Y2.h：位置为 SDK_2.2_MCIM6ULL&#x2F;devices&#x2F;MCIMX6Y2&#x2F;MCIMX6YH2.h</p>
</blockquote>
<p>整个 SDK 包我们就需要上面这三个文件，把这三个文件准备好，我们后面移植要用。  </p>
<h2 id="4-Linux下的SDK安装"><a href="#4-Linux下的SDK安装" class="headerlink" title="4. Linux下的SDK安装"></a><font size=3>4. Linux下的SDK安装</font></h2><p>我们拷贝到ubuntu中后，直接.&#x2F;xxx.run即可执行：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108231432633.png" alt="image-20241108231432633" style="zoom: 50%;" />

<p>这里我们选择同意，然后来到这里：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108231513047.png" alt="image-20241108231513047" style="zoom:50%;" />

<p>这里是选择安装目录，前两个都是默认路径，想安装到哪里的话可以选择，不过我安装到这个路径下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">/home/sumu/7Linux/SDK_2.2_MCIM6ULL/</span><br></pre></td></tr></table></figure>

<p>所以选择第三个，然后输入路径后按下确认：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108231732108.png" alt="image-20241108231732108" style="zoom:50%;" />

<p>这里继续确认，确认后目录不存在的花灰提示创建：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108231754147.png" alt="image-20241108231754147" style="zoom:50%;" />

<p>这里我们选择创建即可，然后就是一直按确定就行了，最后来到安装的部分：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108231847004.png" alt="image-20241108231847004" style="zoom:50%;" />

<p>这里注意一下路径是否则正确，然后选择安装即可。安装完毕会退出这个图形界面，并且给出提示：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108231949813.png" alt="image-20241108231949813" style="zoom:50%;" />

<p>然后我们来看一下都有哪些文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108232045368.png" alt="image-20241108232045368" style="zoom:50%;" />

<p>其实文件跟windows下是一样的。</p>
<h1 id="二、SDK目录、文件简介"><a href="#二、SDK目录、文件简介" class="headerlink" title="二、SDK目录、文件简介"></a><font size=3>二、SDK目录、文件简介</font></h1><p>主要后面还是在linux中开发，所以这里就以linux下的SDK为例。关于这个目录和文件的介绍可以看这个文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108232222020.png" alt="image-20241108232222020" style="zoom:50%;" />

<p>这个会有很多的说明。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">sumu@sumu-virtual-machine:~/7Linux/SDK_2.2_MCIM6ULL$ tree -L 1</span><br><span class="line">.</span><br><span class="line">├── boards                      # 示例程序</span><br><span class="line">├── CMSIS                       # CMSIS标准文件</span><br><span class="line">├── CORTEXA                     # 内核头文件</span><br><span class="line">├── devices                     # 固件库</span><br><span class="line">├── docs                        # 文档</span><br><span class="line">├── EVK-MCIMX6ULL_manifest.xml  # </span><br><span class="line">├── LA_OPT_Base_License.htm</span><br><span class="line">├── middleware                  # 中间件</span><br><span class="line">├── rtos                        # 实时操作系统 </span><br><span class="line">├── SW-Content-Register.txt</span><br><span class="line">└── tools                       # 烧写工具等</span><br><span class="line"></span><br><span class="line">8 directories, 3 files</span><br></pre></td></tr></table></figure>



<h2 id="1-boards：示例程序"><a href="#1-boards：示例程序" class="headerlink" title="1. boards：示例程序"></a><font size=3>1. boards：示例程序</font></h2><p>SDK的boards目录包含了NXP官方评估版MCIMX6ULL-EVK的各种示例程序。例如，下图是“boards&#x2F;evkmcimx6ull”目录。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108232544959.png" alt="image-20241108232544959" style="zoom:50%;" />

<p>这些文件夹的说明如下：</p>
<ul>
<li>demo_apps：包含了一些应用范例，如串口打印“hello world”、使用lwip协议栈进行网络通讯等内容</li>
<li>driver_examples包含了i.mx6主要片上外设的使用范例。</li>
<li>project_template包含了官方示例使用的一些必备文件，这些文件主要是针对官方评估板做了一些引脚定义、时钟配置等功能。</li>
<li>rtos_examples包含了使用FreeRTOS实时操作系统的应用范例。</li>
<li>usb_examples包含了各种USB程序示例。USB设备种类繁多且驱动复杂， 参考官方的这些示例能快速建立自己需要的USB应用。</li>
</ul>
<h2 id="2-CMSIS：包含CMSIS标准相关的文件"><a href="#2-CMSIS：包含CMSIS标准相关的文件" class="headerlink" title="2. CMSIS：包含CMSIS标准相关的文件"></a><font size=3>2. CMSIS：包含CMSIS标准相关的文件</font></h2><p>在2.2版本的SDK中，CMSIS只有一个GCC 相关头文件，使用到时我们将会详细学习。</p>
<h2 id="3-CORTEXA：Cortex相关头文件"><a href="#3-CORTEXA：Cortex相关头文件" class="headerlink" title="3. CORTEXA：Cortex相关头文件"></a><font size=3>3. CORTEXA：Cortex相关头文件</font></h2><p>SDK目录下的CORTEXA文件夹包含了cortexa核适配iar、gcc的头文件。我们暂时不需要研究它们的作用。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108233226929.png" alt="image-20241108233226929" style="zoom:50%;" />

<h2 id="4-devices：i-mx固件库"><a href="#4-devices：i-mx固件库" class="headerlink" title="4. devices：i.mx固件库"></a><font size=3>4. devices：i.mx固件库</font></h2><p>SDK中的devices目录包含的内容就是外设驱动固件库，该目录下的MCIMX6Y2文件夹即是针对开发板板载芯片对应的固件库：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108233344721.png" alt="image-20241108233344721" style="zoom:50%;" />

<h3 id="4-1-MCIMX6Y2目录下的全局文件"><a href="#4-1-MCIMX6Y2目录下的全局文件" class="headerlink" title="4.1 MCIMX6Y2目录下的全局文件"></a><font size=3>4.1 MCIMX6Y2目录下的全局文件</font></h3><p>在MCIMX6Y2根目录下，可发现它直接包含一些文件，这些文件非常重要，是使用固件库编程最基础的部分。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108233522145.png" alt="image-20241108233522145" style="zoom:50%;" />

<p>（1）fsl_device_registers.h文件：根据CPU型号包含相应的头文件（在开发环境的全局宏定义中应根据CPU 指定芯片型号）。固件库通常可以兼容很多型号的芯片，不同的芯片部分寄存器定义、芯片特性等内容可能会有差异。通过这样的条件编译代码，就可以根据宏来包含不同的头文件，达到兼容不同芯片的目的了。当前仅支持一种芯片。</p>
<p>（2）MCIMX6Y2.h文件：它主要是包含i.MX6芯片的各种寄存器定义和中断编号定义，是非常重要，非常基础的一个头文件。 会在前面fsl_device_registers.h文件中就根据CPU型号添加这个文件。</p>
<p>（3）MCIMX6Y2_features.h：此文件主要定义了一些关于i.MX6芯片特性的内容，例如我们想知道本芯片有多少个IIS外设或UART外设，可以在这个文件中找到。在前面的fsl_device_registers.h的内容中也包含了这个文件。</p>
<p>（4）system_MCIMX6Y2.c&#x2F;h文件：system_MCIMX6Y2包含一个源文件和头文件。其中头文件system_MCIMX6Y2.h中主要包含时钟定义以及源文件相应函数的声明。而源文件system_MCIMX6Y2.c中则主要包含系统初始化和配置系统时钟的函数。</p>
<p>（5）MCIMX6Y2.xml文件：MCIMX6Y2.xml文件是NXP的开发环境需要的一些记录信息。</p>
<h3 id="4-2-gcc目录"><a href="#4-2-gcc目录" class="headerlink" title="4.2 gcc目录"></a><font size=3>4.2 gcc目录</font></h3><p>Windows版本的SDK还会有一个iar目录，在不同的编译平台下，使用汇编语言编写的启动文件、各种版本的分散加载文件的语法稍有区别，所以固件库把这些内容放在独立的文件夹。gcc和iar文件夹分别对应ARM-GCC和IAR开发环境，这些文件夹内的文件功能是一样的。这里linux版本的SDK只有gcc目录，我们看一下：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108234339000.png" alt="image-20241108234339000" style="zoom:50%;" />

<p>这里都是一些链接文件。</p>
<h3 id="4-3-drivers目录"><a href="#4-3-drivers目录" class="headerlink" title="4.3 drivers目录"></a><font size=3>4.3 drivers目录</font></h3><p>drivers目录是固件库的主体，有时我们把这些文件称为外设驱动库，具体如下所示：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108234621773.png" alt="image-20241108234621773" style="zoom:50%;" />

<ul>
<li>这些文件都使用fsl_xxx.c&#x2F;h的命名格式，其中xxx是对应的片上 外设名字，如ADC、GPIO、UART、I2C等外设，大部分外设包含一个C源文件和头文件。</li>
<li>当使用到某个外设时，我们会把此处对应的外设驱动源文 件添加到工程中，加入编译，对于没有源文件的IOMUXC外设，则直接使用“#include”包含其头文件fsl_iomuxc.h。</li>
<li>特别地，其中的fsl_common.c和fsl_common.h中的common不是i.MX6芯片 的某个外设名字，它表示绝大多数工程都会需要这些“共同”的内容，所以一般工程都 会添加这个fsl_common.c文件，并且可以通过fsl_common.h文件包含前面介绍的fsl_device_regi sters.h头文件，达到最终包含具有大量寄存器定义的MCIMX6Y2.h核心头文件的目的。</li>
</ul>
<h3 id="4-4-utilities目录"><a href="#4-4-utilities目录" class="headerlink" title="4.4 utilities目录"></a><font size=3>4.4 utilities目录</font></h3><p>utilities是实用工具集的意思，此目录下包含了开发常用的一些调试工具，如串口输出、运行日志，通常我们都会把这些文件加到工程以方便开发。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108234810461.png" alt="image-20241108234810461" style="zoom:50%;" />

<h2 id="5-docs：部分说明文档"><a href="#5-docs：部分说明文档" class="headerlink" title="5.  docs：部分说明文档"></a><font size=3>5.  docs：部分说明文档</font></h2><p>回到SDK的根目录，打开它的docs文件夹，可见到文件夹中包含如下图中的内容：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108234912254.png" alt="image-20241108234912254" style="zoom:50%;" />

<p>这目录下有个《Getting Started with MCUXpresso SDK for i.MX 6ULL Derivatives》文件，它介绍了使用官方评估板时的基础使用步骤。文件夹 lwip、rtos、usb、分别保存对应的说明文档。文件夹MCUXpresso SDK API Reference Manual_MCIMX6Y2保存有.html格式的SDK API接口函数说明文档。</p>
<h2 id="6-middleware：中间件"><a href="#6-middleware：中间件" class="headerlink" title="6. middleware：中间件"></a><font size=3>6. middleware：中间件</font></h2><p>SDK中的middleware文件夹主要包含一些中间层软件，即这些软件常为应用层提供一些协议、架构上的支撑，它的主要部分又与芯片底层的硬件外设驱动(前面drivers目录中的文件)联系不甚紧密，是不同芯片之间通用的一些构件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108235013631.png" alt="image-20241108235013631" style="zoom:50%;" />

<ul>
<li>fatfs ：这是一个嵌入式常用的文件系统，有了文件系统后能更好地管理存储器以及使用通用的文件形式来访问存储器。</li>
<li>lwip ：这是嵌入式常用网络TCP&#x2F;IP协议栈，使用协议栈可以方便地接入网络。</li>
<li>sdmmc ：它是遵照SDIO协议编写的集成识别、读写SD存储卡功能的驱动。</li>
<li>usb ：包含了遵照USB协议编写的基本驱动，在它之上可方便地编写USB应用程序。</li>
</ul>
<h2 id="7-rtos：实时操作系统"><a href="#7-rtos：实时操作系统" class="headerlink" title="7. rtos：实时操作系统"></a><font size=3>7. rtos：实时操作系统</font></h2><p>SDK目录下的rtos文件夹包含了FreeRTOS实时操作系统的源代码，位于“boards&#x2F;evkmcimx6ull&#x2F;rtos_examples”目录的FreeRTOS例程会使用到这里的源码，我们只需要知道源码再这里就可以了。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108235214530.png" alt="image-20241108235214530" style="zoom:50%;" />

<h2 id="8-tools：开发工具"><a href="#8-tools：开发工具" class="headerlink" title="8. tools：开发工具"></a><font size=3>8. tools：开发工具</font></h2><p>各个文件中间件的简要说明如下：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108235315643.png" alt="image-20241108235315643" />

<ul>
<li>cmake_toolchain_files ：提供cmake工具，用于生成arm gcc编译器需要的makefile文件。</li>
<li>imgutil ：提供图片压缩工具。</li>
<li>mfgtools 与 mfgtools-with-rootfs （Windows SDK中会有这个）：提供MFG批量下载工具，</li>
</ul>
<h2 id="9-其它文件"><a href="#9-其它文件" class="headerlink" title="9. 其它文件"></a><font size=3>9. 其它文件</font></h2><p>在SDK的根目录下还包含了几个.xml、.txt、.htm以及.bat文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241108235438401.png" alt="image-20241108235438401" style="zoom:50%;" />

<p>.xml和txt文件它们主要是包含SDK第三方构件的一些版权、出处说明以及EVK-MCIMX6UL生成的一些说明信息，Windows版本SDK中还会有keilkill.bat批处理文件用于清理编译程序生成的中间文件。</p>
<h1 id="三、官方demo"><a href="#三、官方demo" class="headerlink" title="三、官方demo"></a><font size=3>三、官方demo</font></h1><h2 id="1-SDK-demo说明"><a href="#1-SDK-demo说明" class="headerlink" title="1. SDK demo说明"></a><font size=3>1. SDK demo说明</font></h2><p>我们这里以linux下的SDK为例，inux下的SDK是没有IAR版本的demo的。只有armgcc版本。我们可以看一下这个hello world：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line">sumu@sumu-virtual-machine:~/7Linux/SDK_2.2_MCIM6ULL/boards/evkmcimx6ull/demo_apps/hello_world$ tree</span><br><span class="line">.</span><br><span class="line">├── armgcc</span><br><span class="line">│   ├── build_all.bat</span><br><span class="line">│   ├── build_all.sh</span><br><span class="line">│   ├── build_ddr_debug.bat</span><br><span class="line">│   ├── build_ddr_debug.sh</span><br><span class="line">│   ├── build_ddr_release.bat</span><br><span class="line">│   ├── build_ddr_release.sh</span><br><span class="line">│   ├── build_debug.bat</span><br><span class="line">│   ├── build_debug.sh</span><br><span class="line">│   ├── build_release.bat</span><br><span class="line">│   ├── build_release.sh</span><br><span class="line">│   ├── clean.bat</span><br><span class="line">│   ├── clean.sh</span><br><span class="line">│   ├── CMakeLists.txt</span><br><span class="line">│   ├── MCIMX6Y2xxx05_flash.ld</span><br><span class="line">│   └── MCIMX6Y2xxx05_ram.ld</span><br><span class="line">├── board.c</span><br><span class="line">├── board.h</span><br><span class="line">├── clock_config.c</span><br><span class="line">├── clock_config.h</span><br><span class="line">├── clock_config_ocram.c</span><br><span class="line">├── ddr_init.jlinkscript</span><br><span class="line">├── example.xml</span><br><span class="line">├── hello_world.c</span><br><span class="line">├── hello_world.img</span><br><span class="line">├── hello_world.xml</span><br><span class="line">├── pin_mux.c</span><br><span class="line">├── pin_mux.h</span><br><span class="line">└── readme.txt</span><br><span class="line"></span><br><span class="line">1 directory, 28 files</span><br></pre></td></tr></table></figure>

<p>可以看到arngcc文件夹下包含很多build_xx脚本，这些脚本用于在linux环境下编译生成.bin 可执行文件， 所以我们需要一个arm gcc交叉编译器。CMakeList.txt用于生成编译过程中需要的Makefile，所以我们还需要一个CMake工具。 以.ld结尾的文件是链接器脚本相关文件，根据运行的脚本不同，脚本会自动调用相应的链接文件。</p>
<h2 id="2-linux搭建SDK编译环境"><a href="#2-linux搭建SDK编译环境" class="headerlink" title="2. linux搭建SDK编译环境"></a><font size=3>2. linux搭建SDK编译环境</font></h2><h3 id="2-1-cmake"><a href="#2-1-cmake" class="headerlink" title="2.1 cmake"></a><font size=3>2.1 cmake</font></h3><p>我们可以看一下cmake有没有安装，若是没安装，可以用这个命令安装：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get install cmake</span><br></pre></td></tr></table></figure>

<p>我们可以用这个命令查看版本：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cmake --version</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109000047807.png" alt="image-20241109000047807" style="zoom: 50%;" />

<h3 id="2-2-交叉编译工具"><a href="#2-2-交叉编译工具" class="headerlink" title="2.2 交叉编译工具"></a><font size=3>2.2 交叉编译工具</font></h3><h4 id="2-2-1-用的什么交叉编译器？"><a href="#2-2-1-用的什么交叉编译器？" class="headerlink" title="2.2.1 用的什么交叉编译器？"></a><font size=3>2.2.1 用的什么交叉编译器？</font></h4><p>官方demo用的是什么工具？我们打开一个脚本看一眼：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109000335236.png" alt="image-20241109000335236"  />

<p>发现这里会使用armgcc.cmake这个文件，我们到tool目录下看一下这个文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109000608729.png" alt="image-20241109000608729" />

<p>可以看到这里有一个交叉编译工具链的目录配置和前缀配置，由此可知，编译demo需要使用arm-none-eabi-gcc。但是我们之前没有安装这个，那就装一个吧。</p>
<h4 id="2-2-2-安装arm-none-eabi"><a href="#2-2-2-安装arm-none-eabi" class="headerlink" title="2.2.2 安装arm-none-eabi"></a><font size=3>2.2.2 安装arm-none-eabi</font></h4><details class="folding-tag" blue><summary> 错误的尝试1 </summary>
              <div class='content'>
              <p>我们来到交叉编译工具链的官网：<a target="_blank" rel="noopener" href="https://launchpad.net/gcc-arm-embedded">GNU Arm Embedded Toolchain in Launchpad</a>：</p><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109001057719.png" alt="image-20241109001057719" /><p>我们点一些这个<a target="_blank" rel="noopener" href="https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/downloads">External downloads</a>我们可以找到这里：<a target="_blank" rel="noopener" href="https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads">Arm GNU Toolchain Downloads – Arm Developer</a>：</p><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109001317852.png" alt="image-20241109001317852" /><p>然后就会发现这个页面的版本都很新，也没啥必要，这里我们装一个和arm-linux-gnueabihf-gcc 8.3.0同一年份的版本吧：<a target="_blank" rel="noopener" href="https://developer.arm.com/downloads/-/gnu-a">Downloads | GNU-A Downloads – Arm Developer</a></p><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109001620071.png" alt="image-20241109001620071" style="zoom:50%;" /><p>跑到这里一看，好像没有arm-none-eabi，那这没办法了，往前找找，看看哪个版本有就装那个吧，由于这个SDK也挺早了，所以最好还是装个年份差不多的，防止有问题，往前找的话会发现这个版本有：</p><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109002746246.png" alt="image-20241109002746246" /><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109002816679.png" alt="image-20241109002816679" /><p>那就安装这个吧：<a target="_blank" rel="noopener" href="https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz">https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-arm-none-eabi.tar.xz</a></p><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109003257181.png" alt="image-20241109003257181" /><p>这里还有一个坑，就是安装完后，用这个编译工具链编译会报错：</p><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109004848638.png" alt="image-20241109004848638" />
              </div>
            </details>

<details class="folding-tag" blue><summary> 错误的尝试2 </summary>
              <div class='content'>
              <p>上面安装不是有问题吗，我们看一下文档吧：</p><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109005107980.png" alt="image-20241109005107980" /><p>翻译一下最后一句就是：GCC工具链应与最新支持的版本相对应，如MCUXpresso SDK发行说明中所述。(文档MCUXSDKRN)。虽然没怎么看懂，但是我去翻了一下demo中的说明文档：</p><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109005233167.png" alt="image-20241109005233167" /><p>发现这里有写交叉编译工具链的版本，那我还有啥说的，直接去搜这个就是了，可以找到这个页面<a target="_blank" rel="noopener" href="https://developer.arm.com/downloads/-/gnu-rm/5-2016-q3-update">Downloads | 5-2016-q3-update – Arm Developer</a>或者<a target="_blank" rel="noopener" href="https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q3-update">5-2016-q3-update : Series 5.0 : GNU Arm Embedded Toolchain (launchpad.net)</a></p><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109005327756.png" alt="image-20241109005327756" /><p>下载完毕后，会发现这是一个脚本：</p><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109005451529.png" alt="image-20241109005451529" /><p>那就直接执行吧：</p><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109005638457.png" alt="image-20241109005638457" /><p>待执行完毕，我们会看到如下</p><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109005720748.png" alt="image-20241109005720748" /><p>没看见可执行文件啊，我们怎么用？这样用：</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">source /home/sumu/2software/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi</span><br></pre></td></tr></table></figure><p>然后到最后发现，工具名不对啊，又踩一个坑。</p>
              </div>
            </details>

<p>最后一次尝试，后来总是找不到合适的版本，那就按照野火的教程试一下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get install gcc-arm-none-eabi</span><br></pre></td></tr></table></figure>

<p>安装完毕后看一下版本：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">sumu@sumu-virtual-machine:~$ arm-none-eabi-gcc -v</span><br><span class="line">Using built-in specs.</span><br><span class="line">COLLECT_GCC=arm-none-eabi-gcc</span><br><span class="line">COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-none-eabi/9.2.1/lto-wrapper</span><br><span class="line">Target: arm-none-eabi</span><br><span class="line">Configured with: ../configure --build=x86_64-linux-gnu --prefix=/usr --includedir=&#x27;/usr/lib/include&#x27; --mandir=&#x27;/usr/lib/share/man&#x27; --infodir=&#x27;/usr/lib/share/info&#x27; --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir=&#x27;/usr/lib/lib/x86_64-linux-gnu&#x27; --libexecdir=&#x27;/usr/lib/lib/x86_64-linux-gnu&#x27; --disable-maintainer-mode --disable-dependency-tracking --mandir=/usr/share/man --enable-languages=c,c++,lto --enable-multilib --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --enable-tls --build=x86_64-linux-gnu --target=arm-none-eabi --with-system-zlib --with-gnu-as --with-gnu-ld --with-pkgversion=15:9-2019-q4-0ubuntu1 --without-included-gettext --prefix=/usr/lib --infodir=/usr/share/doc/gcc-arm-none-eabi/info --htmldir=/usr/share/doc/gcc-arm-none-eabi/html --pdfdir=/usr/share/doc/gcc-arm-none-eabi/pdf --bindir=/usr/bin --libexecdir=/usr/lib --libdir=/usr/lib --disable-libstdc++-v3 --host=x86_64-linux-gnu --with-headers=no --without-newlib --with-multilib-list=rmprofile CFLAGS=&#x27;-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-Gl9kT9/gcc-arm-none-eabi-9-2019-q4=. -fstack-protector-strong&#x27; CPPFLAGS=&#x27;-Wdate-time -D_FORTIFY_SOURCE=2&#x27; CXXFLAGS=&#x27;-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-Gl9kT9/gcc-arm-none-eabi-9-2019-q4=. -fstack-protector-strong&#x27; FCFLAGS=&#x27;-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-Gl9kT9/gcc-arm-none-eabi-9-2019-q4=. -fstack-protector-strong&#x27; FFLAGS=&#x27;-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-Gl9kT9/gcc-arm-none-eabi-9-2019-q4=. -fstack-protector-strong&#x27; GCJFLAGS=&#x27;-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-Gl9kT9/gcc-arm-none-eabi-9-2019-q4=. -fstack-protector-strong&#x27; LDFLAGS=&#x27;-Wl,-Bsymbolic-functions -Wl,-z,relro&#x27; OBJCFLAGS=&#x27;-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-Gl9kT9/gcc-arm-none-eabi-9-2019-q4=. -fstack-protector-strong&#x27; OBJCXXFLAGS=&#x27;-g -O2 -fdebug-prefix-map=/build/gcc-arm-none-eabi-Gl9kT9/gcc-arm-none-eabi-9-2019-q4=. -fstack-protector-strong&#x27; INHIBIT_LIBC_CFLAGS=-DUSE_TM_CLONE_REGISTRY=0 AR_FOR_TARGET=arm-none-eabi-ar AS_FOR_TARGET=arm-none-eabi-as LD_FOR_TARGET=arm-none-eabi-ld NM_FOR_TARGET=arm-none-eabi-nm OBJDUMP_FOR_TARGET=arm-none-eabi-objdump RANLIB_FOR_TARGET=arm-none-eabi-ranlib READELF_FOR_TARGET=arm-none-eabi-readelf STRIP_FOR_TARGET=arm-none-eabi-strip</span><br><span class="line">Thread model: single</span><br><span class="line">gcc version 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599] (15:9-2019-q4-0ubuntu1) </span><br></pre></td></tr></table></figure>

<p>但是其实吧，这里的版本跟上面手动安装的一样，但是不是很清楚为什么那次尝试没成功？难道是安装目录问题？算了，不纠结了，这也不重要。</p>
<h2 id="3-编译demo"><a href="#3-编译demo" class="headerlink" title="3. 编译demo"></a><font size=3>3. 编译demo</font></h2><p>我们来到hello world这个demo的armgcc目录下，编译这个demo，我们执行这个脚本:</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">./build_release.sh</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109003521525.png" alt="image-20241109003521525" />

<p>然后发现报错了，这是因为没有指定交叉编译工具链的位置，我们指定一下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">不需要到bin这一级 arm-none-eabi-gcc的上一级目录即可</span></span><br><span class="line">export ARMGCC_DIR=/usr</span><br></pre></td></tr></table></figure>

<p>然后重新执行脚本就没问题啦：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109012131735.png" alt="image-20241109012131735" />

<p>然后我们会在boards&#x2F;evkmcimx6ull&#x2F;demo_apps&#x2F;hello_world&#x2F;armgcc路径下生成这两个目录：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">sumu@sumu-virtual-machine:~/7Linux/SDK_2.2_MCIM6ULL/boards/evkmcimx6ull/demo_apps/hello_world/armgcc$ tree -L 2</span><br><span class="line">.</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">......</span></span><br><span class="line">├── CMakeFiles</span><br><span class="line">│   ├── 3.16.3</span><br><span class="line">│   ├── cmake.check_cache</span><br><span class="line">│   ├── CMakeDirectoryInformation.cmake</span><br><span class="line">│   ├── CMakeOutput.log</span><br><span class="line">│   ├── hello_world.elf.dir</span><br><span class="line">│   ├── Makefile2</span><br><span class="line">│   ├── Makefile.cmake</span><br><span class="line">│   ├── progress.marks</span><br><span class="line">│   └── TargetDirectories.txt</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">......</span></span><br><span class="line">└── release</span><br><span class="line">    ├── hello_world.elf</span><br><span class="line">    └── sdk20-app.bin</span><br></pre></td></tr></table></figure>

<p>生成的是CMakeFiles和release目录，得到的成果物在release中。这个sdk20-app.bin就是做后得到的bin文件。</p>
<h2 id="4-烧录到SD卡"><a href="#4-烧录到SD卡" class="headerlink" title="4. 烧录到SD卡"></a><font size=3>4. 烧录到SD卡</font></h2><p>官方的SDK也同样为我们提供了裸机的烧录方式，我们看一下这个SDK_2.2_MCIM6ULL&#x2F;tools&#x2F;imgutil目录下的readme文件：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">IMGUTIL User Guide</span><br><span class="line">  </span><br><span class="line">======================================</span><br><span class="line"></span><br><span class="line">1. Build SDK2.0 application</span><br><span class="line">2. Copy built binary (.bin file) to imgutil/&lt;board&gt; folder and rename to sdk20-app.bin</span><br><span class="line">3. In imgutil/&lt;board&gt; folder, run mkimage.sh in mingw32 shell to get bootable image file sdk20-app.img</span><br><span class="line">    a. If the image is built with ram link file, use &quot;mkimage.sh ram&quot; to make the bootable image.</span><br><span class="line">    b. If the image is built with flash link file, use &quot;mkimage.sh flash&quot; to make the bootable XIP image.</span><br><span class="line">    c. If the image is built with ram link file and want to boot from MicroSD card, use &quot;mkimage.sh sd&quot; to make the bootable image.</span><br><span class="line"></span><br><span class="line">======================================</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>从这里我们可以知道我们需要把.bin文件拷贝到 imgutil&#x2F;&lt;board&gt;目录下，然后重命名为sdk20-app.bin，然后执行mkimage.sh sd就可以生成img文件，我们可以来试一下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mkimage.sh sd</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109074127335.png" alt="image-20241109074127335" />

<p>发现这里提示权限不够，我们修改一下上面两个bin文件的权限：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">chmod 777 ../bin/dcdgen.bin</span><br><span class="line">chmod 777 ../bin/imgutil.bin</span><br></pre></td></tr></table></figure>

<p>然后我们会看到以下打印信息：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">sumu@sumu-virtual-machine:~/7Linux/SDK_2.2_MCIM6ULL/tools/imgutil/evkmcimx6ull$ ./mkimage.sh sd</span><br><span class="line">Get command: set 0x020c4068 0xffffffff </span><br><span class="line">Get command: set 0x020c406c 0xffffffff </span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">......</span></span><br><span class="line"></span><br><span class="line">Combined Image Info:</span><br><span class="line">--------------------------------------</span><br><span class="line">   base_addr         = 0x80000000</span><br><span class="line">   ivt_offset        = 0x00000400</span><br><span class="line">   hab_ivt.hdr       = 0x412000d1</span><br><span class="line">   hab_ivt.entry     = 0x80002000</span><br><span class="line">   hab_ivt.self      = 0x80000400</span><br><span class="line">   hab_ivt.csf       = 0x00000000</span><br><span class="line">   hab_ivt.boot_data = 0x80000420</span><br><span class="line">   hab_ivt.dcd       = 0x80000440</span><br><span class="line">   boot_data.start   = 0x80000000</span><br><span class="line">   boot_data.size    = 0x00007e50</span><br><span class="line">   boot_data.plugin  = 0x00000000</span><br><span class="line"></span><br><span class="line"> Info for CSF file generation</span><br><span class="line">--------------------------------------</span><br><span class="line">   ivt_addr  = 0x80000400, ivt_offset  = 0x00000400</span><br><span class="line">   app_addr  = 0x80002000, app_offset  = 0x00002000, app_size = 0x00005e60</span><br><span class="line">--------------------------------------</span><br></pre></td></tr></table></figure>

<p>然后就会生成一个img文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109074809711.png" alt="image-20241109074809711" />

<p>我们使用dd命令将这个img文件烧写到sd卡中：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo dd if=sdk20-app.img of=/dev/sdx bs=512 conv=fsync</span><br></pre></td></tr></table></figure>

<p>这个img文件直接从0开始烧写就可以了，这里设置块大小为512。</p>
<h2 id="5-开发板验证"><a href="#5-开发板验证" class="headerlink" title="5. 开发板验证"></a><font size=3>5. 开发板验证</font></h2><p>我们将拨码开关拨到SD卡启动：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20240117190003663.png" alt="image-20240117190003663" style="zoom:33%;" />

<p>然后启动开发板，发现是跑不起来的，我猜测可能是硬件上哪里不兼容吧，不过问题不大，后面我们是移植这个SDK来用于自己的工程中，这里主要是学习一下怎么用这个工具烧录。</p>
<h1 id="四、使用SDK控制GPIO"><a href="#四、使用SDK控制GPIO" class="headerlink" title="四、使用SDK控制GPIO"></a><font size=3>四、使用SDK控制GPIO</font></h1><h2 id="1-SDK移植"><a href="#1-SDK移植" class="headerlink" title="1. SDK移植"></a><font size=3>1. SDK移植</font></h2><p>我们需要的的三个文件如下，前边已经说明了这三个文件的位置。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20230728194306338.png" alt="image-20230728194306338" style="zoom:50%;" />

<p>这三个文件直接编译的话肯定会出错的！需要对其做删减，因为这三个文件里面的代码都比较大  我们可以看这里：<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/imx6ull-bare-demo/commit/1e13542c9ddeedf57b68ef44bf5dbc0cab81f7c2">01_GPIO_LED&#x2F;05_led_c_nxp_sdk——C语言点亮LED实验(NXP官方SDK移植) · 1e13542 · sumumm&#x2F;imx6ull-bare-demo - Gitee.com</a>，这一次的提交我同时修改了编译脚本和Makefile文件，可以直接看上边这三个文件的更改就会知道文件发生了哪些变化了。</p>
<h2 id="2-新建cc-h文件"><a href="#2-新建cc-h文件" class="headerlink" title="2. 新建cc.h文件  "></a><font size=3>2. 新建cc.h文件  </font></h2><p>新建一个名为 cc.h 的头文件， cc.h 里面存放一些 SDK 库文件需要使用到的数据类型，可以看工程里边的：<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/imx6ull-bare-demo/blob/1e13542c9ddeedf57b68ef44bf5dbc0cab81f7c2/01_GPIO_LED/05_led_c_nxp_sdk/cc.h">01_GPIO_LED&#x2F;05_led_c_nxp_sdk&#x2F;cc.h · sumumm&#x2F;imx6ull-bare-demo - 码云 - 开源中国 (gitee.com)</a></p>
<h2 id="3-其他文件"><a href="#3-其他文件" class="headerlink" title="3. 其他文件"></a><font size=3>3. 其他文件</font></h2><p>像led的GPIO配置，延时函数、时钟配置等与前边都是一样的，只是我们可以使用SDK中已经定义好的一些函数和结构体来实现，就不需要自己再定义了，这里就不详细说明了，大概了解就可以了。</p>
<h2 id="4-编译和下载"><a href="#4-编译和下载" class="headerlink" title="4. 编译和下载"></a><font size=3>4. 编译和下载</font></h2><p>我在工程里写了脚本和Makefile文件，可以直接使用脚本来编译：<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/imx6ull-bare-demo/blob/master/01_GPIO_LED/05_led_c_nxp_sdk/1.sh">01_GPIO_LED&#x2F;05_led_c_nxp_sdk&#x2F;1.sh · 苏木&#x2F;imx6ull-bare-demo - 码云 - 开源中国 (gitee.com)</a>。我们编译完后，可以通过这个脚本完成下载功能：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/LV04-03-BSP%E5%B7%A5%E7%A8%8B%E7%AE%A1%E7%90%86-01-NXP%E5%AE%98%E6%96%B9SDK/img/image-20241109123712304.png" alt="image-20241109123712304" />

<h2 id="5-链接地址"><a href="#5-链接地址" class="headerlink" title="5. 链接地址"></a><font size=3>5. 链接地址</font></h2><p>我们在mkimage.sh中会看到这么一句：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">../bin/$IMG_BUILDER --combine base_addr=0x80000000 ivt_offset=0x400 app_offset=0x2000 dcd_file=dcd.bin app_file=sdk20-app.bin ofile=sdk20-app.img image_entry_point=0x80002000</span><br></pre></td></tr></table></figure>

<p>这个主要是生成img文件的，按理来说image_entry_point这个值应该填我们的链接文件中链接的地址，我们这里注意和链接脚本保持一致。</p>
<p>注意：其实吧这里我试过，编译的时候链接脚本是0x87800000，这个烧写工具填0x80002000的话也能跑，不是很明白内部是怎么搞的，我甚至还试了mkimage工具，好像也一样，有点不懂，后面有问题再补充吧。</p>
<h2 id="6-开发板测试"><a href="#6-开发板测试" class="headerlink" title="6. 开发板测试"></a><font size=3>6. 开发板测试</font></h2><p>我们将拨码开关拨到SD卡启动，然后复位开发板，我们就可以看到灯闪烁了。</p>

    </div>

    
    
    

    <footer class="post-footer">




    <div>
        
            <div style="text-align:center;color: #ccc;font-size:14px;">
            ----------本文结束
            <i class="fas fa-fan fa-spin" style="color: #FF1493; font-size: 1rem"></i>
            感谢您的阅读----------
            </div>
        
    </div>





  
  <div class="my_post_copyright"> 
    <p><span>文章标题:</span><a href="/post/60d938cb.html">LV04-03-BSP工程管理-01-NXP官方SDK</a></p>
    <p><span>文章作者:</span><a href="/" title="欢迎访问 《苏木》 的学习笔记">苏木</a></p>
    <p><span>发布时间:</span>2023年09月08日 - 19:24</p>
    <p><span>最后更新:</span>2025年06月14日 - 00:25</p>
    <p><span>原始链接:</span><a href="/post/60d938cb.html" title="LV04-03-BSP工程管理-01-NXP官方SDK">https://sumumm.github.io/post/60d938cb.html</a></p>
    <p><span>许可协议:</span><i class="fab fa-creative-commons"></i> <a rel="license" href= "https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
  </div>
  


          <div class="post-tags">
              <a href="/tags/ALPHA-LV04-%E8%A3%B8%E6%9C%BA%E5%BC%80%E5%8F%91/" rel="tag"><i class="fa fa-tag"></i> (ALPHA)LV04-裸机开发</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/post/254de3ea.html" rel="prev" title="LV04-03-BSP工程管理-02-管理工程">
                  <i class="fa fa-angle-left"></i> LV04-03-BSP工程管理-02-管理工程
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/post/38dd5157.html" rel="next" title="LV04-01-IMX6ULL启动流程-03-映像文件">
                  LV04-01-IMX6ULL启动流程-03-映像文件 <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 2017 – 
    <span itemprop="copyrightYear">2025</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">苏木</span>
  </div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">3.7m</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">225:26</span>
  </span>
</div>




    <span id="sitetime"></span>
    <script defer language=javascript>
        function siteTime()
        {
            window.setTimeout("siteTime()", 1000);
            var seconds = 1000;
            var minutes = seconds * 60;
            var hours = minutes * 60;
            var days = hours * 24;
            var years = days * 365;
            var today = new Date();
            var todayYear = today.getFullYear();
            var todayMonth = today.getMonth()+1;
            var todayDate = today.getDate();
            var todayHour = today.getHours();
            var todayMinute = today.getMinutes();
            var todaySecond = today.getSeconds();
            /*==================================================
            Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
            year        - 作为date对象的年份，为4位年份值
            month       - 0-11之间的整数，做为date对象的月份
            day         - 1-31之间的整数，做为date对象的天数
            hours       - 0(午夜24点)-23之间的整数，做为date对象的小时数
            minutes     - 0-59之间的整数，做为date对象的分钟数
            seconds     - 0-59之间的整数，做为date对象的秒数
            microseconds - 0-999之间的整数，做为date对象的毫秒数
            ==================================================*/
            var t1 = Date.UTC(2017, 
                              5, 
                              19, 
                              0, 
                              0, 
                              0); //北京时间
            var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
            var diff = t2-t1;
            var diffYears = Math.floor(diff/years);
            var diffDays = Math.floor((diff/days)-diffYears*365);
            var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
            var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
            var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
            document.getElementById("sitetime").innerHTML="已在这里 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒";
        }
        siteTime();
    </script>



    </div>
  </footer>

  
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.umd.js" integrity="sha256-ytMJGN3toR+a84u7g7NuHm91VIR06Q41kMWDr2pq7Zo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lozad.js/1.16.0/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>




  <script src="/js/third-party/fancybox.js"></script>

  <script src="/js/third-party/pace.js"></script>


  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


 
        <div id="click-show-text"
            data-mobile = false
            data-text = 富强,民主,文明,和谐,自由,平等,公正,法制,爱国,敬业,诚信,友善
            data-fontsize = 15px
            data-random= false>
        </div>
       

      
        <script async src=https://cdn.jsdelivr.net/npm/hexo-next-mouse-effect@latest/click/showText.js></script>
      

      
    




    <script async src="/js/fancybox_param.js"></script>





<!-- APlayer本体 -->



</body>
</html>
